package util;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileOut {

	public static boolean saveFile(byte[] bytes, String path) {
		boolean status = false;
		BufferedOutputStream bos = null;
		FileOutputStream fos = null;
		File file = new File(path);
		try {
			fos = new FileOutputStream(file);
			bos = new BufferedOutputStream(fos);
			bos.write(bytes);
			status = true;
		} catch (Exception e) {
			status = false;
			e.printStackTrace();
		} finally {
			if (bos != null) {
				try {
					bos.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			if (fos != null) {
				try {
					fos.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return status;
	}

}
